package com.yunji.web.order;

import com.yunji.common.base.BaseController;
import com.yunji.order.business.OrderBusiness;
import com.yunji.order.business.RefundBusiness;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * @Project: yunji-coffee
 * @Package: com.yunji.web.order
 * @Title: WechatController
 * @Description: 用户模块微信支付
 * <p>
 * History:
 * Date                     Version     Author          Summary
 * ============================================================
 * 2024-04-13 17:07:01      V1.0        HuaAo       新建类
 */
@Api(tags = "三方回调-微信支付")
@RestController
@RequestMapping("/gateway/wechat")
public class WechatController extends BaseController {
    @Resource
    private OrderBusiness business;

    @Resource
    private RefundBusiness refundBusiness;

    @ApiOperation("商品购买微信回调")
    @PostMapping("/trade/callback")
    public Map<String, Object> payable(HttpServletRequest request) {
        return business.paidCallback(request);
    }

    @ApiOperation("用户退款微信回调")
    @PostMapping("/refund/callback")
    public Map<String, Object> refund(HttpServletRequest request) {
        return refundBusiness.refundCallback(request);
    }

//    @ApiOperation("用户充值微信回调")
//    @PostMapping("/recharge/callback")
//    public Map<String, Object> recharge(HttpServletRequest request) {
//        return business.recharge();
//    }

//    @ApiOperation("用户转账微信宝回调")
//    @PostMapping("/payout/callback")
//    public Map<String, Object> payout(HttpServletRequest request) {
//        return business.payout(request);
//    }

//    @ApiOperation("用户微信发货")
//    @PostMapping("/delivered")
//    public Response<String> delivered(Long orderId) {
//        business.wechatDelivered(orderId);
//        return ResponseHelper.success();
//    }
}
